package com.example.spring.ioc.example;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import com.example.spring.ioc.example.model.Person;

/**
 * 
 * @author jiang
 *
 */
public class Example1 {

	public static void main(String[] args) {
		// 直接向容器添加指定的类作为Bean，不需要注解 @Bean 定义
		AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Person.class);

		Person perosn = ctx.getBean(Person.class);
		System.out.println(perosn.say());

		// 默认bean id 即类名全小写
		System.out.println(ctx.getBean("person"));

		ctx.close();
	}

}
